package steak.xteamy;

import net.fabricmc.api.ModInitializer;
import net.minecraft.component.ComponentType;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.util.Identifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import steak.xteamy.VoiceChat.FunctionComponent;
import steak.xteamy.VoiceChat.StatusEffect.ClimbableStatusEffect;
import steak.xteamy.VoiceChat.StatusEffect.HelicopterModeStatusEffect;

public class KillerGroup implements ModInitializer {

    public static final String MOD_NAME = "KillerGroup";
    public static final String MOD_ID = "killergroup";

    public static final Logger LOGGER = LoggerFactory.getLogger(MOD_NAME);

    public static final ComponentType<FunctionComponent> USE_FUNCTION_COMPONENT = Registry.register(Registries.DATA_COMPONENT_TYPE, IdentifierMod("use_function"), new ComponentType.Builder<FunctionComponent>().codec(FunctionComponent.CODEC).packetCodec(FunctionComponent.PACKET_CODEC).build());

    public static final RegistryEntry<StatusEffect> CLIMBABLE = register("climbable", new ClimbableStatusEffect());
    public static final RegistryEntry<StatusEffect> HELICOPTER_MODE = register("helicopter_mode", new HelicopterModeStatusEffect());

    @Override
    public void onInitialize() {
    }

    private static RegistryEntry<StatusEffect> register(String id, StatusEffect statusEffect) {
        return Registry.registerReference(Registries.STATUS_EFFECT, IdentifierMod(id), statusEffect);
    }

    public static Identifier IdentifierMod(String path) {
        return Identifier.of(MOD_ID, path);
    }
}
